package cn.xiaomubiao.oschine.fragment;

import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import cn.xiaomubiao.oschine.R;

/**
 * 侧滑菜单布局视图
 *
 * @author 张伟斌
 */

public class LeftDrawerFragment extends Fragment {

    private int[] picIds = {R.drawable.drawer_icon_blog_selecor, R.drawable.drawer_icon_exit_selector, R.drawable.drawer_icon_gitapp_selector
            , R.drawable.drawer_icon_opensoft_selector, R.drawable.drawer_icon_quest_selector, R.drawable.drawer_icon_settin_selector};
    private int[] tvIds = {R.id.tv_drawer_quest, R.id.tv_drawer_open_soft, R.id.tv_drawer_blog
            , R.id.tv_drawer_git, R.id.tv_drawer_setting, R.id.tv_drawer_exit};


    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {

        //将布局文件打气为view返回
        View view = inflater.inflate(R.layout.view_left_fragment, container, false);

        //
        for (int i = 0; i < picIds.length; i++) {
            Drawable drawable = getResources().getDrawable(picIds[i]);
            drawable.setBounds(0, 0, (int) (drawable.getIntrinsicWidth()*0.7), (int) (drawable.getIntrinsicHeight()*0.7));
            int tvId = tvIds[i];
            TextView textview = (TextView) view.findViewById(tvId);
            textview.setCompoundDrawables(drawable, null, null, null);

        }

        //返回
        return view;

    }
}